<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/resources/jstl_contexpath.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title>虎丘婚纱城管理系统</title>
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/bs3/css/bootstrap.min.css" />" />
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/bootstrap-reset.css" />" />
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/font-awesome/css/font-awesome.css" />" />
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/clndr.css" />" />
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/style.css" />" />
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/style-responsive.css" />" />

    <!-- start: CSS -->
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/assets/css/bootstrap.min.css" />" />
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/assets/css/style.min.css" />" />
    <link rel="stylesheet" type="text/css" href="<c:url value="/resources/assets/css/retina.min.css" />" />
    <!-- end: CSS -->

    <!-- start: Favicon and Touch Icons -->
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="<c:url value="/resources/assets/ico/apple-touch-icon-144-precomposed.png" />" />
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="<c:url value="/resources/assets/ico/apple-touch-icon-114-precomposed.png" />" />
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="<c:url value="/resources/assets/ico/apple-touch-icon-72-precomposed.png" />" />
    <link rel="apple-touch-icon-precomposed" sizes="57x57" href="<c:url value="/resources/assets/ico/apple-touch-icon-57-precomposed.png" />" />
    <link rel="shortcut icon" href="<c:url value="/resources/assets/ico/favicon.png" />" />
    <!-- end: Favicon and Touch Icons -->

</head>
<body>

<!-- start: Header -->
<%@ include file="/resources/head.jsp" %>
<!-- end: Header -->

<div class="container">
    <div class="row">
        <!-- start: Main Menu -->
        <%@ include file="/resources/sidebar.jsp" %>
        <!-- end: Main Menu -->

        <!-- start: Content -->
        <div id="content" class="col-lg-10 col-sm-11">
            <div class="row">
                <div class="col-lg-12">
                    <div class="box">
                        <div class="box-header">
                            <h2><i class="fa fa-align-justify"></i><span class="break"></span>修改密码</h2>
                            <div class="box-icon">
                            </div>
                        </div>
                        <div class="box-content">
                            <table class="table table-bordered table-striped table-condensed">
                                <tr>
                                    <td width="15%" class="tableleft">原密码</td>
                                    <td><input type="text" name="old_password" id="old_password"/></td>
                                </tr>
                                <tr>
                                    <td class="tableleft">新密码</td>
                                    <td><input type="text" name="new_password" id="new_password"/></td>
                                </tr>
                                <tr>
                                    <td class="tableleft">确认新密码</td>
                                    <td><input type="text" name="confirm_password" id="confirm_password"/></td>
                                </tr>
                                <tr>
                                    <td class="tableleft"></td>
                                    <td>
                                        <button type="button" class="btn btn-primary" name="save" id="save">保存</button>&nbsp;&nbsp;
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div><!--/col-->
            </div>
        </div>
    </div>
</div>
<%@ include file="/resources/managerfoot.jsp"%>

<!-- start: JavaScript-->
<script type="text/javascript" src="<c:url value="/resources/assets/js/jquery-2.1.0.min.js" />" ></script>
<script type="text/javascript" src="<c:url value="/resources/assets/js/jquery-migrate-1.2.1.min.js" />" ></script>
<script type="text/javascript" src="<c:url value="/resources/assets/js/bootstrap.min.js" />" ></script>

<!-- page scripts -->
<script type="text/javascript" src="<c:url value="/resources/assets/js/jquery-ui-1.10.3.custom.min.js" />" ></script>
<script type="text/javascript" src="<c:url value="/resources/assets/js/jquery.sparkline.min.js" />" ></script>
<script type="text/javascript" src="<c:url value="/resources/assets/js/jquery.dataTables.min.js" />" ></script>
<script type="text/javascript" src="<c:url value="/resources/assets/js/dataTables.bootstrap.min.js" />" ></script>

<!-- theme scripts -->
<script type="text/javascript" src="<c:url value="/resources/assets/js/custom.min.js" />" ></script>
<script type="text/javascript" src="<c:url value="/resources/assets/js/core.min.js" />" ></script>

<!-- inline scripts related to this page -->
<script type="text/javascript" src="<c:url value="/resources/assets/js/pages/table.js" />" ></script>

<!-- end: JavaScript-->

<script>
    $(function () {
        $('#save').click(function(){
            var old_password = $('#old_password').val();
            var new_password = $('#new_password').val();
            var confirm_password = $('#confirm_password').val();
            if(old_password == null || '' == old_password) {
                alert("请输入原密码");
                return false;
            }
            if(new_password == null || '' == new_password) {
                alert("请输入新密码");
                return false;
            }
            if(confirm_password == null || '' == confirm_password) {
                alert("请输入确认密码");
                return false;
            }
            if(new_password != confirm_password) {
                alert("请输入相同新密码！");
                return false;
            }
            $.ajax({
                type:'POST',
                url:'${ctx}/manage/system/password/domodify',
                data:{old_password:old_password,new_password:new_password,confirm_password:confirm_password},
                success: function(data){
                    if(data == -1) {
                        alert("原密码与当前密码不同");
                        return false;
                    }
                    if(data == -2) {
                        alert("新密码与确认密码不同");
                        return false;
                    }
                    if(data > 0) {
                        alert("成功！");
                        location.reload();
                    } else {
                        alert("失败！");
                        return false;
                    }
                }
            });
        });
    });
</script>
</body>
</html>